﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace NUnitTestRunnerWP7
{
    public partial class UnitTestsListPage : PhoneApplicationPage
    {
        public UnitTestsListPage()
        {
            InitializeComponent();
            this.DataContext = ViewModels.ResultsListViewModel.Intance;
        }

        private void lstTests_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // If selected index is -1 (no selection) do nothing
            if (lstTests.SelectedIndex == -1)
                return;

            // Navigate to the new page
            NavigationService.Navigate(new Uri("/NUnitTestRunnerWP7;component/UnitTestDetailsPage.xaml?selectedItem=" + lstTests.SelectedIndex, UriKind.Relative));
            lstTests.SelectedIndex = -1;
        }
    }
}